class ReglesController < ApplicationController
  # GET /regles
  # GET /regles.xml
  def index
    @regles = Regle.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @regles }
    end
  end

  # GET /regles/1
  # GET /regles/1.xml
  def show
    @regle = Regle.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @regle }
    end
  end

  # GET /regles/new
  # GET /regles/new.xml
  def new
    @regle = Regle.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @regle }
    end
  end

  # GET /regles/1/edit
  def edit
    @regle = Regle.find(params[:id])
  end

  # POST /regles
  # POST /regles.xml
  def create
    @regle = Regle.new(params[:regle])

    respond_to do |format|
      if @regle.save
        flash[:notice] = 'Regle was successfully created.'
        format.html { redirect_to(@regle) }
        format.xml  { render :xml => @regle, :status => :created, :location => @regle }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @regle.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /regles/1
  # PUT /regles/1.xml
  def update
    @regle = Regle.find(params[:id])

    respond_to do |format|
      if @regle.update_attributes(params[:regle])
        flash[:notice] = 'Regle was successfully updated.'
        format.html { redirect_to(@regle) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @regle.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /regles/1
  # DELETE /regles/1.xml
  def destroy
    @regle = Regle.find(params[:id])
    @regle.destroy

    respond_to do |format|
      format.html { redirect_to(regles_url) }
      format.xml  { head :ok }
    end
  end
end
